using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControl_DangNhap : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (txtTenDangNhap.Text == "" && txtPass.Value == "")
        {
            lbThongBao.Visible = true;
            return;
        }
        else lbThongBao.Visible = false;
        TaiKhoanDTO tkDto = new TaiKhoanDTO();
        TaiKhoanBUS tkBus = new TaiKhoanBUS();
        tkDto = tkBus.getTaiKhoan(txtTenDangNhap.Text, txtPass.Value);
        if (tkDto.MaTaiKhoan != "")
        {
            lbThongBao.Visible = false;

            Session["TenDangNhap"] = tkDto.MaTaiKhoan;
            switch (tkDto.LoaiTaiKhoan)
            {
                case 1:
                    Response.Redirect("../SinhVien/DanhSachLuanVanDK.aspx");
                    break;
                case 2:
                    Response.Redirect("../GiaoVien/DanhSachGiaoVien.aspx");
                    break;
                case 3:
                    break;
            }
        }
        else
            lbThongBao.Visible = true;
    }
    
}
